First, let's talk about the use of $elemMatch:{ _id: 1, results: [[+ ]] { _id: 2, results: [[], +/- ] }
$elemMatch is that at least one element in the array matching document satisfies all the conditions in $elemmatch, for example:db. Scores. Find ({results: { $elemMatch : { $gte : 80 $lt : 85 } } Span class= "p" >}) query result: { "_id" : 1, "Results" : [[A] [[+ ]] To explain it (Multikey Index
Cookie Encapsulation JS/** * Cookie plugin** Copyright (c) 2006 Ziqiu.zhang * Dual licensed under the MIT and GPL licenses:*http://www.opensource.org/licenses/mit-license.php* http://www.gnu.org/licenses/gpl.html* Use Example://Note: When writing, subname parameter pass NULL value or NULL//write cookies-value to string, that is, do not include sub-key $.cookie ("Singlekey", "", "Singlekey-value", { expires:1, Path: "/", secure:false})//Read cookies-According to the primary key alert ("Singlek
)
Multikey index (Multi-key indexing)
An example of this is given in the official documentation:{userid: "marker", address:[{zip: "618255"}, {zip: "618254"}]}# create the index and arrange the zip in ascending order Db.users.ensureIndex ( {"Address.zip": 1}); # If we do such a query Db.users.find ({"addr": {"$in": [{zip: "618254"}]})Note: You can create a multi-key composite index (Multikey co
Emergency out of a bad, but can not continue to write, write less, first put Shard key and hash of some small concepts continue to write.Shard KeysThe most important thing about MongoDB's sharding is Shard key. Shard with Shard Key, and divide and move chunk by the size of the specified chunk (described later). Some features of Shard key:Shard key cannot be Multikey indexWhat is Mutikey index? Addr[on the way] This array is called Mutikey index. Shard
, and delete Cookies
Method parameters:
Name
Description
Example
Name
Primary Key Value of cookies
Read primary key:$. Cookie ("singleKey ")Write cookies. The value is a string:$. Cookie ("singleKey", "", "singleKey-value", {expires: 1, path: "/", secure: false })
SubName
The subkey name. When writing data, pass null or null.
Read subkeys:$. Cookie ("multiKey", "subName1 ")Write cookies. The value is an obj
typed object.
(3) using JavaScript to manipulate cookies
We also need to operate cookies on the client.
The following is a packaged jquery tool function designed to operate cookies.Of course, this tool function can be changed to a standard JavaScript function by slightly modifying it.
Download Address
Tool Function Description:
Method signature: Jquery.cookie (name, subname, value, options)
Method Description: Read, write, delete cookies
Method Parameters:
Name
Descrip
previous and subsequent M/2 elements into buffer and sorts the elements in the buffer, then reads the next element from the beginning (or end) of the sorted array, If this element is smaller than the smallest element in the buffer, write it to the first vacancy, and if the element is greater than the largest element in the buffer, write to the last empty space, otherwise write the largest or smallest element in the buffer to the array and place the element in buffer. Keep the maximum value belo
plan returned by the query optimizer for that query. "Stage": "Fetch",//the stage of the optimal execution plan, where return is FETCH, can be understood as retrieving the specific document by returning the index position (see below) "Inputstage": {//the child on the previous stage
Stage, here is Ixscan, indicating that the index scanning is in progress. "Stage": "IXSCAN", "Keypattern": {"W": 1,//index content scanned "n": 1
The number of bars returned? }, "Inde
entire subdocument will only improve the query speed of the entire subdocument; that is, the sub-document index will only work if the query that exactly matches the subdocument (including the field order);(2) Only query loc.city field, index loc.city will work, other conditions index loc.city not work;Second, the index on the array(1) It can be seen that the cost of establishing an index on an array field is relatively large, because each time the deletion, the update will refresh each index, c
different types of data elements, including inline documents and arrays. All MongoDB middle Key-value pairs support data types that can be used as values for arrays.
An array is a set of values, expressed in square brackets, that can be used as an ordered object (list, stack, queue), or as an unordered object (such as a collection) to manipulate
An array can contain elements of different data types (strings, floats, documents, and so on), for example: [3.14, "Hello", [+/-a], {"Key"
Tags: contains duplicate ntop username commit CTI Title cannot openIndex typeAlthough the index of MongoDB is the same on the storage structure, it is divided into several types such as unique index (unique), sparse index (sparse), multivalued index (multikey) according to different application layer requirements.Unique indexThe unique index is created with the option to add unique:true, and the command is created as follows: Db.users.ensureIndex ({us
index of the slice key cannot be specified as the following types of indexes: Multikey index, text index, geospatial index.The tablet key is immutableIn the collection of shards that have been completed, you can no longer modify the slice key if you have to modify it:1. Turn all data in MongoDB into other formats2. Delete the previous Shard collection.3. Configure the Shard to use the new (need to modify) the chip key;4. Pre-dividing the range of the
This article is based on Kyle banker's MongoDB in action book. This section describes some basic knowledge and usage skills related to MongoDB indexes.
Index type
Although MongoDB indexes have the same storage structure, they are still divided into unique indexes (unique), sparse indexes (sparse), and multi-value indexes (multikey) based on different application layer requirements).
Unique Index
The unique index can be created with the unique: true op
operations until the Ajax request is complete. Note that this will disable all sorting, navigation, or any toolbar operations.
Default Value: Enable
This attribute can be modified
Mtype
String
Determine the request method. "Post" or "get"
Default Value: Get
This attribute can be modified
Multikey
String
It makes sense only when the multiselect option is set to true. Define which key is used for multiple selections. Value Options: shiftkey/altkey/ctrl
data is requested and sorted
Loading ...
Loadui
String
This controls the action of the AJAX process. disable-cancels Jqgrid process instructions, you can use custom instructions. Enable (default)-Displays loading in the middle of the table. block– displays "Loading" information, disabling all features on the page until the data is loaded.
Enable
Mtype
String
Define a Submit type Post or get
Get
Copies of "One" Bag.getcount ("one"); //returns 4 has corresponding interface implementations for sorting and sorting bag. Here is a translation of an article in the Internet, Source: HTTP://WWW.DEVX.COM/JAVA/ARTICLE/29392/0/PAGE/3 JDK does not already have a Java collection framework, Why use the Apache collection? This is because Apache's collection is a complement and enhancement of the JDK collection, which provides more interfaces and implementation classes. Even it should be part of the J
attribute, which defines the total number of pages
0
Whether
Lastsort
Integer
Read-only property that defines the index of the last row sequence, starting with 0
0
Whether
Loadonce
Boolean
If ture, the data is fetched only once from the server, after which all operations are performed on the client, and the paging feature is disabled
False
Whether
LoadText
String
The text that is displayed when requested or sort
be explained later in this article).
QueryPlanner.winningPlan.inputStage: Used to describe the child stage and provide document and index keywords for its parent stage.
QueryPlanner.winningPlan.stage's child stage, here is Ixscan, indicates that the index scanning is being carried out.
QueryPlanner.winningPlan.keyPattern: The index content scanned, here is did:1,status:1,modify_time:-1 and Scid:1
Index selected by QueryPlanner.winningPlan.indexName:winning plan.
If the QueryPlanner.winningPlan.
()
ObjectldOBJECTLD consists of 24 hexadecimal characters, each byte storing two hexadecimal digits, a total of 12 bytes of storage spaceEach byte represents the following meanings:The objectld generated in this way is still unique in the distribution.related functions :
Objectld ()Used to obtain OBJECTLD
Gettimestamp ()Timestamp used to obtain the OBJECTLD
ValueOf ()The string representation used to get objectld
19 Documents:3 > x = ObjectId()ObjectId("5a7866e7564037
documents with the same name field, apparently by the name field, and by finding the age field in a document of the same name is more efficient.Multi-key index (Multikey index)When an indexed field is an array, the index created is called a multi-key index, and a multi-key index establishes an index for each element of the array, such as a person table that joins a habbit field (array) to describe interests, A multi-key index of the Habbit field is a
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.